{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "data = pd.read_csv('./data_jsee.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "data = data.iloc[:,2:]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0         1.6042\n",
       "1         1.5903\n",
       "2         1.6597\n",
       "3         1.6736\n",
       "4         1.6319\n",
       "           ...  \n",
       "257393    2.3056\n",
       "257394    2.5417\n",
       "257395    2.5208\n",
       "257396    2.4792\n",
       "257397    2.4583\n",
       "Name: CO含量, Length: 257398, dtype: float64"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data['CO含量']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>CO含量</th>\n",
       "      <th>HCL含量</th>\n",
       "      <th>NOx含量</th>\n",
       "      <th>SO2含量</th>\n",
       "      <th>一次风调门</th>\n",
       "      <th>一次风量</th>\n",
       "      <th>主蒸汽流量设定值</th>\n",
       "      <th>二次风调门</th>\n",
       "      <th>二次风量</th>\n",
       "      <th>引风机转速</th>\n",
       "      <th>...</th>\n",
       "      <th>推料器手动指令</th>\n",
       "      <th>推料器自动指令</th>\n",
       "      <th>推料器自动投退信号</th>\n",
       "      <th>氧量设定值</th>\n",
       "      <th>汽包水位</th>\n",
       "      <th>炉排启停</th>\n",
       "      <th>炉排手动指令</th>\n",
       "      <th>炉排实际运行指令</th>\n",
       "      <th>炉排自动投退信号</th>\n",
       "      <th>给水流量</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1.6042</td>\n",
       "      <td>6.1991</td>\n",
       "      <td>57.4444</td>\n",
       "      <td>2.6458</td>\n",
       "      <td>75.5532</td>\n",
       "      <td>72919.6563</td>\n",
       "      <td>60.0</td>\n",
       "      <td>20.4653</td>\n",
       "      <td>4330.1270</td>\n",
       "      <td>66.7986</td>\n",
       "      <td>...</td>\n",
       "      <td>53.9083</td>\n",
       "      <td>53.9094</td>\n",
       "      <td>1</td>\n",
       "      <td>5.5</td>\n",
       "      <td>1.6872</td>\n",
       "      <td>1</td>\n",
       "      <td>43.9083</td>\n",
       "      <td>43.9078</td>\n",
       "      <td>1</td>\n",
       "      <td>73.4054</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1.5903</td>\n",
       "      <td>6.2315</td>\n",
       "      <td>57.3889</td>\n",
       "      <td>2.5833</td>\n",
       "      <td>75.4144</td>\n",
       "      <td>73034.8047</td>\n",
       "      <td>60.0</td>\n",
       "      <td>20.5810</td>\n",
       "      <td>4898.9800</td>\n",
       "      <td>66.8056</td>\n",
       "      <td>...</td>\n",
       "      <td>54.0000</td>\n",
       "      <td>54.0353</td>\n",
       "      <td>1</td>\n",
       "      <td>5.5</td>\n",
       "      <td>1.6107</td>\n",
       "      <td>1</td>\n",
       "      <td>44.0000</td>\n",
       "      <td>43.9126</td>\n",
       "      <td>1</td>\n",
       "      <td>73.5788</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1.6597</td>\n",
       "      <td>6.2176</td>\n",
       "      <td>57.5556</td>\n",
       "      <td>2.6181</td>\n",
       "      <td>75.4051</td>\n",
       "      <td>73111.4609</td>\n",
       "      <td>60.0</td>\n",
       "      <td>20.6806</td>\n",
       "      <td>4663.6895</td>\n",
       "      <td>66.8195</td>\n",
       "      <td>...</td>\n",
       "      <td>54.0452</td>\n",
       "      <td>54.0476</td>\n",
       "      <td>1</td>\n",
       "      <td>5.5</td>\n",
       "      <td>1.5039</td>\n",
       "      <td>1</td>\n",
       "      <td>44.0452</td>\n",
       "      <td>44.0439</td>\n",
       "      <td>1</td>\n",
       "      <td>73.7589</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1.6736</td>\n",
       "      <td>6.2083</td>\n",
       "      <td>57.5370</td>\n",
       "      <td>2.6389</td>\n",
       "      <td>75.4537</td>\n",
       "      <td>73134.4375</td>\n",
       "      <td>60.0</td>\n",
       "      <td>20.6991</td>\n",
       "      <td>4898.9800</td>\n",
       "      <td>66.7894</td>\n",
       "      <td>...</td>\n",
       "      <td>54.0575</td>\n",
       "      <td>54.0600</td>\n",
       "      <td>1</td>\n",
       "      <td>5.5</td>\n",
       "      <td>1.5284</td>\n",
       "      <td>1</td>\n",
       "      <td>44.0575</td>\n",
       "      <td>44.0551</td>\n",
       "      <td>1</td>\n",
       "      <td>73.9473</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1.6319</td>\n",
       "      <td>6.1991</td>\n",
       "      <td>57.3889</td>\n",
       "      <td>2.6875</td>\n",
       "      <td>75.4144</td>\n",
       "      <td>73493.5625</td>\n",
       "      <td>60.0</td>\n",
       "      <td>20.8542</td>\n",
       "      <td>4898.9800</td>\n",
       "      <td>66.7662</td>\n",
       "      <td>...</td>\n",
       "      <td>54.0699</td>\n",
       "      <td>54.0724</td>\n",
       "      <td>1</td>\n",
       "      <td>5.5</td>\n",
       "      <td>1.6921</td>\n",
       "      <td>1</td>\n",
       "      <td>44.0699</td>\n",
       "      <td>44.0674</td>\n",
       "      <td>1</td>\n",
       "      <td>74.1118</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 21 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     CO含量   HCL含量    NOx含量   SO2含量    一次风调门        一次风量  主蒸汽流量设定值    二次风调门  \\\n",
       "0  1.6042  6.1991  57.4444  2.6458  75.5532  72919.6563      60.0  20.4653   \n",
       "1  1.5903  6.2315  57.3889  2.5833  75.4144  73034.8047      60.0  20.5810   \n",
       "2  1.6597  6.2176  57.5556  2.6181  75.4051  73111.4609      60.0  20.6806   \n",
       "3  1.6736  6.2083  57.5370  2.6389  75.4537  73134.4375      60.0  20.6991   \n",
       "4  1.6319  6.1991  57.3889  2.6875  75.4144  73493.5625      60.0  20.8542   \n",
       "\n",
       "        二次风量    引风机转速  ...  推料器手动指令  推料器自动指令  推料器自动投退信号  氧量设定值    汽包水位  炉排启停  \\\n",
       "0  4330.1270  66.7986  ...  53.9083  53.9094          1    5.5  1.6872     1   \n",
       "1  4898.9800  66.8056  ...  54.0000  54.0353          1    5.5  1.6107     1   \n",
       "2  4663.6895  66.8195  ...  54.0452  54.0476          1    5.5  1.5039     1   \n",
       "3  4898.9800  66.7894  ...  54.0575  54.0600          1    5.5  1.5284     1   \n",
       "4  4898.9800  66.7662  ...  54.0699  54.0724          1    5.5  1.6921     1   \n",
       "\n",
       "    炉排手动指令  炉排实际运行指令  炉排自动投退信号     给水流量  \n",
       "0  43.9083   43.9078         1  73.4054  \n",
       "1  44.0000   43.9126         1  73.5788  \n",
       "2  44.0452   44.0439         1  73.7589  \n",
       "3  44.0575   44.0551         1  73.9473  \n",
       "4  44.0699   44.0674         1  74.1118  \n",
       "\n",
       "[5 rows x 21 columns]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>CO含量</th>\n",
       "      <th>HCL含量</th>\n",
       "      <th>NOx含量</th>\n",
       "      <th>SO2含量</th>\n",
       "      <th>一次风调门</th>\n",
       "      <th>一次风量</th>\n",
       "      <th>主蒸汽流量设定值</th>\n",
       "      <th>二次风调门</th>\n",
       "      <th>二次风量</th>\n",
       "      <th>引风机转速</th>\n",
       "      <th>...</th>\n",
       "      <th>推料器手动指令</th>\n",
       "      <th>推料器自动指令</th>\n",
       "      <th>推料器自动投退信号</th>\n",
       "      <th>氧量设定值</th>\n",
       "      <th>汽包水位</th>\n",
       "      <th>炉排启停</th>\n",
       "      <th>炉排手动指令</th>\n",
       "      <th>炉排实际运行指令</th>\n",
       "      <th>炉排自动投退信号</th>\n",
       "      <th>给水流量</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>257398.000000</td>\n",
       "      <td>257398.000000</td>\n",
       "      <td>257398.000000</td>\n",
       "      <td>257398.000000</td>\n",
       "      <td>257398.000000</td>\n",
       "      <td>257398.000000</td>\n",
       "      <td>257398.000000</td>\n",
       "      <td>257398.000000</td>\n",
       "      <td>257398.000000</td>\n",
       "      <td>257398.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>257398.000000</td>\n",
       "      <td>257398.000000</td>\n",
       "      <td>257398.000000</td>\n",
       "      <td>257398.000000</td>\n",
       "      <td>257398.000000</td>\n",
       "      <td>257398.000000</td>\n",
       "      <td>257398.000000</td>\n",
       "      <td>257398.000000</td>\n",
       "      <td>257398.000000</td>\n",
       "      <td>257398.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>3.006617</td>\n",
       "      <td>6.750722</td>\n",
       "      <td>64.268478</td>\n",
       "      <td>15.191759</td>\n",
       "      <td>74.595044</td>\n",
       "      <td>78918.051160</td>\n",
       "      <td>60.211712</td>\n",
       "      <td>24.525707</td>\n",
       "      <td>6255.662011</td>\n",
       "      <td>70.309520</td>\n",
       "      <td>...</td>\n",
       "      <td>65.254412</td>\n",
       "      <td>65.671106</td>\n",
       "      <td>0.536508</td>\n",
       "      <td>6.201318</td>\n",
       "      <td>4.995819</td>\n",
       "      <td>0.633470</td>\n",
       "      <td>50.638502</td>\n",
       "      <td>50.637807</td>\n",
       "      <td>0.565168</td>\n",
       "      <td>73.661865</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>15.044500</td>\n",
       "      <td>4.698083</td>\n",
       "      <td>14.453690</td>\n",
       "      <td>21.910244</td>\n",
       "      <td>10.529404</td>\n",
       "      <td>16030.204657</td>\n",
       "      <td>3.651101</td>\n",
       "      <td>17.042472</td>\n",
       "      <td>7525.248806</td>\n",
       "      <td>6.356195</td>\n",
       "      <td>...</td>\n",
       "      <td>13.990916</td>\n",
       "      <td>11.997825</td>\n",
       "      <td>0.498666</td>\n",
       "      <td>2.359463</td>\n",
       "      <td>5.693235</td>\n",
       "      <td>0.481857</td>\n",
       "      <td>10.599538</td>\n",
       "      <td>10.598782</td>\n",
       "      <td>0.495736</td>\n",
       "      <td>6.538865</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>-0.458100</td>\n",
       "      <td>0.407400</td>\n",
       "      <td>20.277800</td>\n",
       "      <td>-0.145800</td>\n",
       "      <td>24.997700</td>\n",
       "      <td>19971.271500</td>\n",
       "      <td>42.655200</td>\n",
       "      <td>9.685200</td>\n",
       "      <td>-0.000000</td>\n",
       "      <td>42.939800</td>\n",
       "      <td>...</td>\n",
       "      <td>30.000000</td>\n",
       "      <td>40.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>2.882800</td>\n",
       "      <td>-27.986900</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>30.000000</td>\n",
       "      <td>29.999800</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>46.870300</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>0.736100</td>\n",
       "      <td>4.023100</td>\n",
       "      <td>54.611100</td>\n",
       "      <td>3.277800</td>\n",
       "      <td>70.553400</td>\n",
       "      <td>70147.445300</td>\n",
       "      <td>60.000000</td>\n",
       "      <td>19.650300</td>\n",
       "      <td>3354.102100</td>\n",
       "      <td>66.467600</td>\n",
       "      <td>...</td>\n",
       "      <td>55.000000</td>\n",
       "      <td>56.231900</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>5.500000</td>\n",
       "      <td>3.087725</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>40.000000</td>\n",
       "      <td>40.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>69.970425</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>1.347200</td>\n",
       "      <td>5.736100</td>\n",
       "      <td>62.777800</td>\n",
       "      <td>6.784700</td>\n",
       "      <td>75.490700</td>\n",
       "      <td>77882.492200</td>\n",
       "      <td>60.000000</td>\n",
       "      <td>19.710600</td>\n",
       "      <td>4062.019000</td>\n",
       "      <td>69.754700</td>\n",
       "      <td>...</td>\n",
       "      <td>60.000000</td>\n",
       "      <td>61.534750</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>5.500000</td>\n",
       "      <td>4.954500</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>50.000000</td>\n",
       "      <td>50.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>73.579750</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>2.194400</td>\n",
       "      <td>8.041700</td>\n",
       "      <td>71.722200</td>\n",
       "      <td>19.611100</td>\n",
       "      <td>80.631900</td>\n",
       "      <td>91782.687500</td>\n",
       "      <td>62.000000</td>\n",
       "      <td>20.838000</td>\n",
       "      <td>5196.152300</td>\n",
       "      <td>74.275500</td>\n",
       "      <td>...</td>\n",
       "      <td>74.727900</td>\n",
       "      <td>72.232925</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>6.000000</td>\n",
       "      <td>6.995050</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>57.968600</td>\n",
       "      <td>57.972500</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>77.542875</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>300.208100</td>\n",
       "      <td>58.004600</td>\n",
       "      <td>134.537000</td>\n",
       "      <td>299.617800</td>\n",
       "      <td>100.023100</td>\n",
       "      <td>122637.046900</td>\n",
       "      <td>70.036100</td>\n",
       "      <td>89.979200</td>\n",
       "      <td>35791.058600</td>\n",
       "      <td>91.249800</td>\n",
       "      <td>...</td>\n",
       "      <td>100.000200</td>\n",
       "      <td>100.000200</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>25.000000</td>\n",
       "      <td>46.922300</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>100.000000</td>\n",
       "      <td>100.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>100.297200</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>8 rows × 21 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                CO含量          HCL含量          NOx含量          SO2含量  \\\n",
       "count  257398.000000  257398.000000  257398.000000  257398.000000   \n",
       "mean        3.006617       6.750722      64.268478      15.191759   \n",
       "std        15.044500       4.698083      14.453690      21.910244   \n",
       "min        -0.458100       0.407400      20.277800      -0.145800   \n",
       "25%         0.736100       4.023100      54.611100       3.277800   \n",
       "50%         1.347200       5.736100      62.777800       6.784700   \n",
       "75%         2.194400       8.041700      71.722200      19.611100   \n",
       "max       300.208100      58.004600     134.537000     299.617800   \n",
       "\n",
       "               一次风调门           一次风量       主蒸汽流量设定值          二次风调门  \\\n",
       "count  257398.000000  257398.000000  257398.000000  257398.000000   \n",
       "mean       74.595044   78918.051160      60.211712      24.525707   \n",
       "std        10.529404   16030.204657       3.651101      17.042472   \n",
       "min        24.997700   19971.271500      42.655200       9.685200   \n",
       "25%        70.553400   70147.445300      60.000000      19.650300   \n",
       "50%        75.490700   77882.492200      60.000000      19.710600   \n",
       "75%        80.631900   91782.687500      62.000000      20.838000   \n",
       "max       100.023100  122637.046900      70.036100      89.979200   \n",
       "\n",
       "                二次风量          引风机转速  ...        推料器手动指令        推料器自动指令  \\\n",
       "count  257398.000000  257398.000000  ...  257398.000000  257398.000000   \n",
       "mean     6255.662011      70.309520  ...      65.254412      65.671106   \n",
       "std      7525.248806       6.356195  ...      13.990916      11.997825   \n",
       "min        -0.000000      42.939800  ...      30.000000      40.000000   \n",
       "25%      3354.102100      66.467600  ...      55.000000      56.231900   \n",
       "50%      4062.019000      69.754700  ...      60.000000      61.534750   \n",
       "75%      5196.152300      74.275500  ...      74.727900      72.232925   \n",
       "max     35791.058600      91.249800  ...     100.000200     100.000200   \n",
       "\n",
       "           推料器自动投退信号          氧量设定值           汽包水位           炉排启停  \\\n",
       "count  257398.000000  257398.000000  257398.000000  257398.000000   \n",
       "mean        0.536508       6.201318       4.995819       0.633470   \n",
       "std         0.498666       2.359463       5.693235       0.481857   \n",
       "min         0.000000       2.882800     -27.986900       0.000000   \n",
       "25%         0.000000       5.500000       3.087725       0.000000   \n",
       "50%         1.000000       5.500000       4.954500       1.000000   \n",
       "75%         1.000000       6.000000       6.995050       1.000000   \n",
       "max         1.000000      25.000000      46.922300       1.000000   \n",
       "\n",
       "              炉排手动指令       炉排实际运行指令       炉排自动投退信号           给水流量  \n",
       "count  257398.000000  257398.000000  257398.000000  257398.000000  \n",
       "mean       50.638502      50.637807       0.565168      73.661865  \n",
       "std        10.599538      10.598782       0.495736       6.538865  \n",
       "min        30.000000      29.999800       0.000000      46.870300  \n",
       "25%        40.000000      40.000000       0.000000      69.970425  \n",
       "50%        50.000000      50.000000       1.000000      73.579750  \n",
       "75%        57.968600      57.972500       1.000000      77.542875  \n",
       "max       100.000000     100.000000       1.000000     100.297200  \n",
       "\n",
       "[8 rows x 21 columns]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "%matplotlib inline\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "y = pd.read_csv('./dataset/train/outputs/主蒸汽流量.csv').iloc[:,-1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    54.3032\n",
       "1    54.1495\n",
       "2    54.4899\n",
       "3    54.6693\n",
       "4    54.5034\n",
       "Name: 主蒸汽流量, dtype: float64"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(257400,)"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(1800, 18)"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>NOx含量</th>\n",
       "      <th>SO2含量</th>\n",
       "      <th>一次风调门</th>\n",
       "      <th>一次风量</th>\n",
       "      <th>主蒸汽流量设定值</th>\n",
       "      <th>二次风调门</th>\n",
       "      <th>二次风量</th>\n",
       "      <th>引风机转速</th>\n",
       "      <th>推料器启停</th>\n",
       "      <th>推料器手动指令</th>\n",
       "      <th>推料器自动指令</th>\n",
       "      <th>推料器自动投退信号</th>\n",
       "      <th>氧量设定值</th>\n",
       "      <th>汽包水位</th>\n",
       "      <th>炉排启停</th>\n",
       "      <th>炉排手动指令</th>\n",
       "      <th>炉排实际运行指令</th>\n",
       "      <th>炉排自动投退信号</th>\n",
       "      <th>给水流量</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>57.4444</td>\n",
       "      <td>2.6458</td>\n",
       "      <td>75.5532</td>\n",
       "      <td>72919.6563</td>\n",
       "      <td>60.0</td>\n",
       "      <td>20.4653</td>\n",
       "      <td>4330.1270</td>\n",
       "      <td>66.7986</td>\n",
       "      <td>NaN</td>\n",
       "      <td>53.9083</td>\n",
       "      <td>53.9094</td>\n",
       "      <td>NaN</td>\n",
       "      <td>5.5</td>\n",
       "      <td>1.6872</td>\n",
       "      <td>NaN</td>\n",
       "      <td>43.9083</td>\n",
       "      <td>43.9078</td>\n",
       "      <td>NaN</td>\n",
       "      <td>73.4054</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>57.3889</td>\n",
       "      <td>2.5833</td>\n",
       "      <td>75.4144</td>\n",
       "      <td>73034.8047</td>\n",
       "      <td>60.0</td>\n",
       "      <td>20.5810</td>\n",
       "      <td>4898.9800</td>\n",
       "      <td>66.8056</td>\n",
       "      <td>NaN</td>\n",
       "      <td>54.0000</td>\n",
       "      <td>54.0353</td>\n",
       "      <td>NaN</td>\n",
       "      <td>5.5</td>\n",
       "      <td>1.6107</td>\n",
       "      <td>NaN</td>\n",
       "      <td>44.0000</td>\n",
       "      <td>43.9126</td>\n",
       "      <td>NaN</td>\n",
       "      <td>73.5788</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>57.5556</td>\n",
       "      <td>2.6181</td>\n",
       "      <td>75.4051</td>\n",
       "      <td>73111.4609</td>\n",
       "      <td>60.0</td>\n",
       "      <td>20.6806</td>\n",
       "      <td>4663.6895</td>\n",
       "      <td>66.8195</td>\n",
       "      <td>NaN</td>\n",
       "      <td>54.0452</td>\n",
       "      <td>54.0476</td>\n",
       "      <td>NaN</td>\n",
       "      <td>5.5</td>\n",
       "      <td>1.5039</td>\n",
       "      <td>NaN</td>\n",
       "      <td>44.0452</td>\n",
       "      <td>44.0439</td>\n",
       "      <td>NaN</td>\n",
       "      <td>73.7589</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>57.5370</td>\n",
       "      <td>2.6389</td>\n",
       "      <td>75.4537</td>\n",
       "      <td>73134.4375</td>\n",
       "      <td>60.0</td>\n",
       "      <td>20.6991</td>\n",
       "      <td>4898.9800</td>\n",
       "      <td>66.7894</td>\n",
       "      <td>NaN</td>\n",
       "      <td>54.0575</td>\n",
       "      <td>54.0600</td>\n",
       "      <td>NaN</td>\n",
       "      <td>5.5</td>\n",
       "      <td>1.5284</td>\n",
       "      <td>NaN</td>\n",
       "      <td>44.0575</td>\n",
       "      <td>44.0551</td>\n",
       "      <td>NaN</td>\n",
       "      <td>73.9473</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>57.3889</td>\n",
       "      <td>2.6875</td>\n",
       "      <td>75.4144</td>\n",
       "      <td>73493.5625</td>\n",
       "      <td>60.0</td>\n",
       "      <td>20.8542</td>\n",
       "      <td>4898.9800</td>\n",
       "      <td>66.7662</td>\n",
       "      <td>NaN</td>\n",
       "      <td>54.0699</td>\n",
       "      <td>54.0724</td>\n",
       "      <td>NaN</td>\n",
       "      <td>5.5</td>\n",
       "      <td>1.6921</td>\n",
       "      <td>NaN</td>\n",
       "      <td>44.0699</td>\n",
       "      <td>44.0674</td>\n",
       "      <td>NaN</td>\n",
       "      <td>74.1118</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>56.9259</td>\n",
       "      <td>2.8958</td>\n",
       "      <td>75.3588</td>\n",
       "      <td>72927.3359</td>\n",
       "      <td>60.0</td>\n",
       "      <td>21.0185</td>\n",
       "      <td>4898.9800</td>\n",
       "      <td>66.7801</td>\n",
       "      <td>NaN</td>\n",
       "      <td>54.0823</td>\n",
       "      <td>54.0847</td>\n",
       "      <td>NaN</td>\n",
       "      <td>5.5</td>\n",
       "      <td>1.7617</td>\n",
       "      <td>NaN</td>\n",
       "      <td>44.0823</td>\n",
       "      <td>44.0798</td>\n",
       "      <td>NaN</td>\n",
       "      <td>74.2273</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>57.0556</td>\n",
       "      <td>2.8819</td>\n",
       "      <td>75.2477</td>\n",
       "      <td>72565.4141</td>\n",
       "      <td>60.0</td>\n",
       "      <td>21.1690</td>\n",
       "      <td>4898.9800</td>\n",
       "      <td>66.8195</td>\n",
       "      <td>True</td>\n",
       "      <td>54.0946</td>\n",
       "      <td>54.0971</td>\n",
       "      <td>True</td>\n",
       "      <td>5.5</td>\n",
       "      <td>1.8370</td>\n",
       "      <td>True</td>\n",
       "      <td>44.0946</td>\n",
       "      <td>44.0921</td>\n",
       "      <td>True</td>\n",
       "      <td>74.3151</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>57.1111</td>\n",
       "      <td>2.8542</td>\n",
       "      <td>75.2384</td>\n",
       "      <td>71991.8828</td>\n",
       "      <td>60.0</td>\n",
       "      <td>21.3009</td>\n",
       "      <td>4898.9800</td>\n",
       "      <td>66.8426</td>\n",
       "      <td>True</td>\n",
       "      <td>54.0435</td>\n",
       "      <td>54.0387</td>\n",
       "      <td>True</td>\n",
       "      <td>5.5</td>\n",
       "      <td>1.9551</td>\n",
       "      <td>True</td>\n",
       "      <td>44.0435</td>\n",
       "      <td>44.1057</td>\n",
       "      <td>True</td>\n",
       "      <td>74.3242</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>56.9444</td>\n",
       "      <td>2.8472</td>\n",
       "      <td>75.3657</td>\n",
       "      <td>71781.4844</td>\n",
       "      <td>60.0</td>\n",
       "      <td>21.3495</td>\n",
       "      <td>4898.9800</td>\n",
       "      <td>66.8356</td>\n",
       "      <td>True</td>\n",
       "      <td>54.0453</td>\n",
       "      <td>54.0469</td>\n",
       "      <td>True</td>\n",
       "      <td>5.5</td>\n",
       "      <td>2.0904</td>\n",
       "      <td>True</td>\n",
       "      <td>44.0453</td>\n",
       "      <td>44.0436</td>\n",
       "      <td>True</td>\n",
       "      <td>74.2533</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>56.7593</td>\n",
       "      <td>2.9236</td>\n",
       "      <td>75.3426</td>\n",
       "      <td>72240.4453</td>\n",
       "      <td>60.0</td>\n",
       "      <td>21.4907</td>\n",
       "      <td>5123.4751</td>\n",
       "      <td>66.8773</td>\n",
       "      <td>True</td>\n",
       "      <td>54.0535</td>\n",
       "      <td>54.0552</td>\n",
       "      <td>True</td>\n",
       "      <td>5.5</td>\n",
       "      <td>2.2391</td>\n",
       "      <td>True</td>\n",
       "      <td>44.0535</td>\n",
       "      <td>44.0527</td>\n",
       "      <td>True</td>\n",
       "      <td>74.2104</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     NOx含量   SO2含量    一次风调门        一次风量  主蒸汽流量设定值    二次风调门       二次风量  \\\n",
       "0  57.4444  2.6458  75.5532  72919.6563      60.0  20.4653  4330.1270   \n",
       "1  57.3889  2.5833  75.4144  73034.8047      60.0  20.5810  4898.9800   \n",
       "2  57.5556  2.6181  75.4051  73111.4609      60.0  20.6806  4663.6895   \n",
       "3  57.5370  2.6389  75.4537  73134.4375      60.0  20.6991  4898.9800   \n",
       "4  57.3889  2.6875  75.4144  73493.5625      60.0  20.8542  4898.9800   \n",
       "5  56.9259  2.8958  75.3588  72927.3359      60.0  21.0185  4898.9800   \n",
       "6  57.0556  2.8819  75.2477  72565.4141      60.0  21.1690  4898.9800   \n",
       "7  57.1111  2.8542  75.2384  71991.8828      60.0  21.3009  4898.9800   \n",
       "8  56.9444  2.8472  75.3657  71781.4844      60.0  21.3495  4898.9800   \n",
       "9  56.7593  2.9236  75.3426  72240.4453      60.0  21.4907  5123.4751   \n",
       "\n",
       "     引风机转速 推料器启停  推料器手动指令  推料器自动指令 推料器自动投退信号  氧量设定值    汽包水位  炉排启停   炉排手动指令  \\\n",
       "0  66.7986   NaN  53.9083  53.9094       NaN    5.5  1.6872   NaN  43.9083   \n",
       "1  66.8056   NaN  54.0000  54.0353       NaN    5.5  1.6107   NaN  44.0000   \n",
       "2  66.8195   NaN  54.0452  54.0476       NaN    5.5  1.5039   NaN  44.0452   \n",
       "3  66.7894   NaN  54.0575  54.0600       NaN    5.5  1.5284   NaN  44.0575   \n",
       "4  66.7662   NaN  54.0699  54.0724       NaN    5.5  1.6921   NaN  44.0699   \n",
       "5  66.7801   NaN  54.0823  54.0847       NaN    5.5  1.7617   NaN  44.0823   \n",
       "6  66.8195  True  54.0946  54.0971      True    5.5  1.8370  True  44.0946   \n",
       "7  66.8426  True  54.0435  54.0387      True    5.5  1.9551  True  44.0435   \n",
       "8  66.8356  True  54.0453  54.0469      True    5.5  2.0904  True  44.0453   \n",
       "9  66.8773  True  54.0535  54.0552      True    5.5  2.2391  True  44.0535   \n",
       "\n",
       "   炉排实际运行指令 炉排自动投退信号     给水流量  \n",
       "0   43.9078      NaN  73.4054  \n",
       "1   43.9126      NaN  73.5788  \n",
       "2   44.0439      NaN  73.7589  \n",
       "3   44.0551      NaN  73.9473  \n",
       "4   44.0674      NaN  74.1118  \n",
       "5   44.0798      NaN  74.2273  \n",
       "6   44.0921     True  74.3151  \n",
       "7   44.1057     True  74.3242  \n",
       "8   44.0436     True  74.2533  \n",
       "9   44.0527     True  74.2104  "
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.iloc[:10]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "y = pd.read_csv('./target.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(257398, 2)"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Unnamed: 0</th>\n",
       "      <th>主蒸汽流量</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>54.3032</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>54.1495</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>54.4899</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3</td>\n",
       "      <td>54.6693</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4</td>\n",
       "      <td>54.5034</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Unnamed: 0    主蒸汽流量\n",
       "0           0  54.3032\n",
       "1           1  54.1495\n",
       "2           2  54.4899\n",
       "3           3  54.6693\n",
       "4           4  54.5034"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "CO含量           4101\n",
       "HCL含量          8208\n",
       "NOx含量          9583\n",
       "SO2含量         17609\n",
       "一次风调门         19924\n",
       "一次风量          10066\n",
       "主蒸汽流量设定值      36165\n",
       "二次风调门         17106\n",
       "二次风量            783\n",
       "引风机转速         34882\n",
       "推料器启停             2\n",
       "推料器手动指令       72044\n",
       "推料器自动指令       73795\n",
       "推料器自动投退信号         2\n",
       "氧量设定值         25736\n",
       "汽包水位         128501\n",
       "炉排启停              2\n",
       "炉排手动指令        59528\n",
       "炉排实际运行指令      59800\n",
       "炉排自动投退信号          2\n",
       "给水流量         155546\n",
       "dtype: int64"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.nunique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "from sklearn.ensemble import RandomForestRegressor\n",
    "from sklearn.model_selection import train_test_split\n",
    "import pandas as pd\n",
    "\n",
    "target = pd.read_csv('./target.csv').iloc[:,1:].values.ravel()\n",
    "Xdata = pd.read_csv('./data_jsee.csv').iloc[:,1:]\n",
    "\n",
    "Xtrain,Xtest,Ytrain,Ytest = train_test_split(Xdata,target,test_size=0.25)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": "(193048, 18)"
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Xtrain.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [],
   "source": [
    "rf = RandomForestRegressor(n_estimators=100,max_depth=7)\n",
    "rf.fit(Xtrain,Ytrain)\n",
    "score = rf.score(Xtest,Ytest)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.8008959436869529"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "score"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>主蒸汽流量</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>54.3032</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>54.1495</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>54.4899</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>54.6693</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>54.5034</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>257393</th>\n",
       "      <td>57.7807</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>257394</th>\n",
       "      <td>57.7987</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>257395</th>\n",
       "      <td>57.7698</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>257396</th>\n",
       "      <td>57.7407</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>257397</th>\n",
       "      <td>58.0246</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>257398 rows × 1 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "          主蒸汽流量\n",
       "0       54.3032\n",
       "1       54.1495\n",
       "2       54.4899\n",
       "3       54.6693\n",
       "4       54.5034\n",
       "...         ...\n",
       "257393  57.7807\n",
       "257394  57.7987\n",
       "257395  57.7698\n",
       "257396  57.7407\n",
       "257397  58.0246\n",
       "\n",
       "[257398 rows x 1 columns]"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "target"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.9985651052487332"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "score"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([4.72397073e-04, 2.98137648e-03, 3.52247357e-02, 8.43789901e-03,\n",
       "       2.43214486e-02, 4.41667526e-05, 1.02638036e-01, 1.13027252e-03,\n",
       "       2.12994500e-03, 6.14898038e-05, 8.23563042e-04, 5.10850600e-03,\n",
       "       1.12293001e-03, 4.91689692e-03, 1.29355827e-02, 6.97255270e-03,\n",
       "       2.46267627e-03, 7.88215526e-01])"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "rf.feature_importances_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'rf' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001B[1;31m---------------------------------------------------------------------------\u001B[0m",
      "\u001B[1;31mNameError\u001B[0m                                 Traceback (most recent call last)",
      "Input \u001B[1;32mIn [4]\u001B[0m, in \u001B[0;36m<cell line: 2>\u001B[1;34m()\u001B[0m\n\u001B[0;32m      1\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01msklearn\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mmodel_selection\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m cross_val_score\n\u001B[1;32m----> 2\u001B[0m score_ \u001B[38;5;241m=\u001B[39m cross_val_score(\u001B[43mrf\u001B[49m,Xdata,target,cv\u001B[38;5;241m=\u001B[39m\u001B[38;5;241m10\u001B[39m)\u001B[38;5;241m.\u001B[39mmean()\n\u001B[0;32m      3\u001B[0m score_\n",
      "\u001B[1;31mNameError\u001B[0m: name 'rf' is not defined"
     ]
    }
   ],
   "source": [
    "from sklearn.model_selection import cross_val_score\n",
    "score_ = cross_val_score(rf,Xdata,target,cv=10).mean()\n",
    "score_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [],
   "source": [
    "import sklearn"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "outputs": [
    {
     "data": {
      "text/plain": "['accuracy',\n 'adjusted_mutual_info_score',\n 'adjusted_rand_score',\n 'average_precision',\n 'balanced_accuracy',\n 'completeness_score',\n 'explained_variance',\n 'f1',\n 'f1_macro',\n 'f1_micro',\n 'f1_samples',\n 'f1_weighted',\n 'fowlkes_mallows_score',\n 'homogeneity_score',\n 'jaccard',\n 'jaccard_macro',\n 'jaccard_micro',\n 'jaccard_samples',\n 'jaccard_weighted',\n 'max_error',\n 'mutual_info_score',\n 'neg_brier_score',\n 'neg_log_loss',\n 'neg_mean_absolute_error',\n 'neg_mean_absolute_percentage_error',\n 'neg_mean_gamma_deviance',\n 'neg_mean_poisson_deviance',\n 'neg_mean_squared_error',\n 'neg_mean_squared_log_error',\n 'neg_median_absolute_error',\n 'neg_root_mean_squared_error',\n 'normalized_mutual_info_score',\n 'precision',\n 'precision_macro',\n 'precision_micro',\n 'precision_samples',\n 'precision_weighted',\n 'r2',\n 'rand_score',\n 'recall',\n 'recall_macro',\n 'recall_micro',\n 'recall_samples',\n 'recall_weighted',\n 'roc_auc',\n 'roc_auc_ovo',\n 'roc_auc_ovo_weighted',\n 'roc_auc_ovr',\n 'roc_auc_ovr_weighted',\n 'top_k_accuracy',\n 'v_measure_score']"
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sorted(sklearn.metrics.SCORERS.keys())"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\24412\\anaconda3\\lib\\site-packages\\xgboost\\data.py:250: FutureWarning: pandas.Int64Index is deprecated and will be removed from pandas in a future version. Use pandas.Index with the appropriate dtype instead.\n",
      "  elif isinstance(data.columns, (pd.Int64Index, pd.RangeIndex)):\n"
     ]
    }
   ],
   "source": [
    "from xgboost import XGBRegressor\n",
    "reg = XGBRegressor(n_estimators=20).fit(Xtrain,Ytrain)\n",
    "reg_score = reg.score(Xtest,Ytest)"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "outputs": [
    {
     "data": {
      "text/plain": "0.9223967836649981"
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "reg_score"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\24412\\anaconda3\\lib\\site-packages\\xgboost\\data.py:250: FutureWarning: pandas.Int64Index is deprecated and will be removed from pandas in a future version. Use pandas.Index with the appropriate dtype instead.\n",
      "  elif isinstance(data.columns, (pd.Int64Index, pd.RangeIndex)):\n",
      "C:\\Users\\24412\\anaconda3\\lib\\site-packages\\xgboost\\data.py:250: FutureWarning: pandas.Int64Index is deprecated and will be removed from pandas in a future version. Use pandas.Index with the appropriate dtype instead.\n",
      "  elif isinstance(data.columns, (pd.Int64Index, pd.RangeIndex)):\n",
      "C:\\Users\\24412\\anaconda3\\lib\\site-packages\\xgboost\\data.py:250: FutureWarning: pandas.Int64Index is deprecated and will be removed from pandas in a future version. Use pandas.Index with the appropriate dtype instead.\n",
      "  elif isinstance(data.columns, (pd.Int64Index, pd.RangeIndex)):\n",
      "C:\\Users\\24412\\anaconda3\\lib\\site-packages\\xgboost\\data.py:250: FutureWarning: pandas.Int64Index is deprecated and will be removed from pandas in a future version. Use pandas.Index with the appropriate dtype instead.\n",
      "  elif isinstance(data.columns, (pd.Int64Index, pd.RangeIndex)):\n",
      "C:\\Users\\24412\\anaconda3\\lib\\site-packages\\xgboost\\data.py:250: FutureWarning: pandas.Int64Index is deprecated and will be removed from pandas in a future version. Use pandas.Index with the appropriate dtype instead.\n",
      "  elif isinstance(data.columns, (pd.Int64Index, pd.RangeIndex)):\n",
      "C:\\Users\\24412\\anaconda3\\lib\\site-packages\\xgboost\\data.py:250: FutureWarning: pandas.Int64Index is deprecated and will be removed from pandas in a future version. Use pandas.Index with the appropriate dtype instead.\n",
      "  elif isinstance(data.columns, (pd.Int64Index, pd.RangeIndex)):\n",
      "C:\\Users\\24412\\anaconda3\\lib\\site-packages\\xgboost\\data.py:250: FutureWarning: pandas.Int64Index is deprecated and will be removed from pandas in a future version. Use pandas.Index with the appropriate dtype instead.\n",
      "  elif isinstance(data.columns, (pd.Int64Index, pd.RangeIndex)):\n",
      "C:\\Users\\24412\\anaconda3\\lib\\site-packages\\xgboost\\data.py:250: FutureWarning: pandas.Int64Index is deprecated and will be removed from pandas in a future version. Use pandas.Index with the appropriate dtype instead.\n",
      "  elif isinstance(data.columns, (pd.Int64Index, pd.RangeIndex)):\n",
      "C:\\Users\\24412\\anaconda3\\lib\\site-packages\\xgboost\\data.py:250: FutureWarning: pandas.Int64Index is deprecated and will be removed from pandas in a future version. Use pandas.Index with the appropriate dtype instead.\n",
      "  elif isinstance(data.columns, (pd.Int64Index, pd.RangeIndex)):\n",
      "C:\\Users\\24412\\anaconda3\\lib\\site-packages\\xgboost\\data.py:250: FutureWarning: pandas.Int64Index is deprecated and will be removed from pandas in a future version. Use pandas.Index with the appropriate dtype instead.\n",
      "  elif isinstance(data.columns, (pd.Int64Index, pd.RangeIndex)):\n"
     ]
    },
    {
     "data": {
      "text/plain": "-10.47740808247859"
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "reg_score_ = cross_val_score(reg,Xdata,target,cv=10,scoring='neg_mean_squared_error').mean()\n",
    "reg_score_"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "outputs": [
    {
     "data": {
      "text/plain": "array([0.010106  , 0.02068154, 0.03694129, 0.02474227, 0.03713959,\n       0.02131671, 0.1259194 , 0.02600622, 0.01689697, 0.01429737,\n       0.01410724, 0.02466196, 0.03247746, 0.03477937, 0.02356138,\n       0.10719857, 0.03098766, 0.39817894], dtype=float32)"
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "reg.feature_importances_"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
